package com.ganbo.thread;

/**
 * Created by gan on 2020/5/18 23:55.
 */
public class JoinDemo extends Thread {

    @Override
    public void run() {
        System.out.println(Thread.currentThread().getName()+" 睡眠之前");
        try {
            Thread.sleep(3000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println(Thread.currentThread().getName()+" 睡眠之后");
    }

    public static void main(String[] args) throws InterruptedException {
        JoinDemo j = new JoinDemo();
        j.start();
        System.out.println("main方法  before....");
        j.join();
        System.out.println("main方法 after...");
    }
}
